package com.tinycloud.miracll.product.api;

import com.tinycloud.common.core.web.controller.BaseController;
import com.tinycloud.common.log.annotation.Log;
import com.tinycloud.common.log.enums.BusinessType;
import com.tinycloud.miracll.product.job.SCADATask;
import com.tinycloud.miracll.product.service.IERPApsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 产品成本Controller
 * 
 * @author tiny
 * @date 2021-08-31
 */
@RestController
@RequestMapping("/api/productAps")
public class ProductApsAPI extends BaseController  {
    @Autowired
    private IERPApsService erpApsService ;

    /**
     * 定时清洗
     */
    @Log(title = "生成排产数据", businessType = BusinessType.INSERT)
    @GetMapping("/geneAPSData")
    @ResponseBody
    public String geneAPSData(@RequestParam("mainBillNum") String mainBillNum)  {

        System.out.println("geneAPSData.................");
        System.out.println("mainBillNum................."+mainBillNum);
        String result = "geneAPSDataSuccess====";
        if(null==mainBillNum||"".equals(mainBillNum)) {
            result ="mainBillNum is null";
            return result;
        }

        try {
            result = erpApsService.geneAPSData(mainBillNum);
        } catch (Exception e) {
            result = "error";
            e.printStackTrace();
        }
        return  result;
    }

}
